/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ucm;

import java.sql.ResultSet;
import sql.Select;

/**
 *
 * @author 马凯
 */
public class StaffInfo_UC {

    private static StaffInfo_UC siuc;
    private String receive;
    private String output = "";

    public static StaffInfo_UC getInstance(String receive) {
        if (siuc == null) {
            siuc = new StaffInfo_UC();
            siuc.receive = receive;
        }
        else
        {
            siuc.receive = receive;
        }
        return siuc;
    }

    public String run() {
        String[] str = receive.split(";");
        String cid = str[0];
        String query = "SELECT 'group' FROM staff WHERE staff_card='" + cid + "';";
        System.out.println(query);
        ResultSet rs = Select.getInstance().selectValue(query);
        try {
            if (rs.wasNull()) {
                output = rs.getString("group") + ";07";
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return output;
    }
}
